package com.biz.primus.app.rest.feign;

import com.biz.primus.app.rest.degraded.DegradedDepotFeignClient;
import com.biz.primus.model.depot.vo.DepotRespVo;
import com.biz.primus.model.depot.vo.FreightTemplateDetailRespVo;
import com.biz.primus.model.depot.vo.SearchDepotConditionVo;
import com.biz.primus.model.depot.vo.SearchDepotResVo;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Optional;

/**
 * DepotFeignClient
 *
 * @author JKLiues
 * @date 2017年11月14日
 */
@FeignClient(qualifier = "depotFeignClient", name = "service-depot", fallback = DegradedDepotFeignClient.class)
public interface DepotFeignClient {

    /**
     * 根据门店编码查门店信息
     *
     * @param depotCode 门店编码
     * @return Optional<DepotRespVo>
     */
    @GetMapping("soa/depotService/getByDepotCodeFRdb")
    Optional<DepotRespVo> getByDepotCodeFRdb(@ApiParam(value = "门店编码") @RequestParam("depotCode") String depotCode);

    /**
     * 根据定位坐标经纬度搜索最近门店
     *
     * @param vo 搜索对象
     * @return 最近门店
     */
    @PostMapping("soa/depotService/searchNearDepot")
    SearchDepotResVo searchNearbyDepot(@RequestBody SearchDepotConditionVo vo);

    /**
     * 根据定位坐标经纬度搜索附近门店
     *
     * @param vo 搜索对象
     * @return 附近门店结果Vo
     */
    @PostMapping("soa/depotService/searchNearDepot")
    List<DepotRespVo> findNearDepots(@RequestBody SearchDepotConditionVo vo);

    /**
     * 获取可用运费策略
     *
     * @return List<FreightTemplateDetailRespVo>
     */
    @GetMapping("soa/depotService/getAllAvailableFreight")
    List<FreightTemplateDetailRespVo> getAllAvailableFreight();

}